<template>
    <div class="search-bar">
        <div class="body row">
            <div class="btn-close icon" @click="onClose">
                <img
                    src="https://7769-winfyho-cloud-0gfbcdsg0e062644-1301825810.tcb.qcloud.la/cloudbase-cms/upload/2021-04-30/olp1bnl2ah9ovfvibrxscgg1xv6ynnut_.png"
                />
            </div>

            <div class="input-bar row">
                <img class="icon" :src="require(`@/assets/icon/search_dark.png`)" />
                <input v-model="keyword" type="text" placeholder="搜索" />
            </div>
            <div class="btn-search" @click="onSearch">搜索</div>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            keyword: ""
        };
    },

    methods: {
        onSearch() {
            this.$emit("search", {
                keyword: this.keyword
            });
        },
        onClose() {
            this.$router.go(-1);
        }
    }
};
</script>


<style lang="less" scoped>
.search-bar {
    padding: 30px 20px;
    font-size: 30px;

    .body {
        justify-content: space-between;
        align-items: center;

        .btn-close {
            margin-right: 20px;
            width: 40px;
            height: 40px;
        }

        .input-bar {
            flex: 1 1 auto;
            background: #fff;
            height: 60px;
            box-sizing: border-box;
            border-radius: 20px;
            padding: 0 30px;
            margin-right: 20px;
            align-items: center;

            .icon {
                flex: 0 0 auto;
                width: 35px;
                height: 35px;
                margin-right: 10px;
            }

            input {
                width: 100%;
                height: 100%;
            }
            input::placeholder {
                color: #999;
            }
        }

        .btn-search {
            flex: 0 0 auto;
            color: #556483;
        }
    }
}
</style>